package feign.controller;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import feign.client.SampleFeignClient;
import feign.serive.SampleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * Created by Administrator on 2016/11/1.
 */
@RestController
public class FeignClientController implements SampleService {
    @Resource
    private SampleFeignClient sampleFeignClient;

//    @Override
//    public String getUserById(@PathVariable("id") String id) {
//        return sampleFeignClient.getUserById(id);
//    }

    @Override
    @HystrixCommand(fallbackMethod = "fallBack")
    public int add(int a,int b) {
        return sampleFeignClient.add(a,b);
    }


    public int fallBack(int a,int b){

        return 7;
    }
}
